Hi reader,

I am about to walk you through a paper entitled Female sociality and sexual conflict shape offspring survival in a Neotropical primate by Kalbitzer et al. (2017). The reason I chose this paper is because it is a study of the Capuchin monkeys who made me fall in love with primatology. On the particularly hard days, they are what remind me why I am here.

Pictured Above: Zoe With One Of The Stars Of The Paper!

Before we begin, lets install the following packages: lme4, tidyverse, ggplot2, ggspignif, dplyr, ggpubr

I have included the code to download these packages bellow:

#Here is the code to install lme4. 
install.packages("lme4",
   repos=c("http://lme4.r-forge.r-project.org/repos",
      getOption("repos")[["CRAN"]]))
#Here is the code to install ggplot2, ggsignif, dplyr and ggpubr.
install.packages("tidyverse")
install.packages("ggplot2")
install.packages("ggsignif")
install.packages("dplyr")
install.packages("ggpubr")

A Brief Introduction

In a 2017 paper by Kalbitzer et al., researchers studying wild white-faced Capuchin monkeys living in Santa Rosa, Costa Rica set out to answer the question “what is the relationship between female sociality, offspring survival, and infanticide risk”?

Their study is based upon the knowledge that most mammalian species live in social groups and they may vary in degrees of sociality, which yield differential fitness. A few studies published prior to this one argued that female sociality has a positive impact on infant survival. However, no studies looked at the role that male reproductive strategies, notably infanticide, might influence the effects that female sociality has on infant survival.

We know that the reproductive strategies of males and females differ and that this may result in sexual conflict. We know too that infanticide significantly increases during periods of alpha male replacements.

In the tables and figures that follow, I will illustrate some of the key findings from their work:

  1. Offspring of highly social and high ranking females had higher survivorship during stable periods.

  2. Offspring of highly social and high ranking females were more likely to die/disappear during periods of alpha male replacements.

  • This is likely because new alpha males move to the center of the group, where highly social females are located.

Therefore it is clear that female sociality may sometimes have negative fitness consequences due to male behavior.

Working with the Data

We begin by downloading the data, so that we may work with it. The authors of this paper put two excel sheets onto this webpage. Only one of them will be relevant to this project.

library(curl)
f <- curl("https://raw.githubusercontent.com/ZoeEAlbert/zalbert-data-replication-assignment/main/Kalbitzer_et_al_capuchin_sociality_dyadic_data.csv")
d <- read.csv(f, header = TRUE, sep = ",", stringsAsFactors = FALSE)
head(d) #This will help us see the top 6 lines of every row. 
##   Group_ID Dyad_ID IndividualA_ID IndividualB_ID Year   DSI RValue_Dyad
## 1        1       1              2              1 2010 1.244       0.062
## 2        1       1              2              1 2011 2.602       0.062
## 3        1       2              8              1 2010 1.387       0.000
## 4        1       2              8              1 2011 1.531       0.000
## 5        1       3             11              1 2010 1.336       0.000
## 6        1       3             11              1 2011 1.298       0.000
##   KinshipCategory_Dyad AgeDifference_years_Dyad DominanceRank_IndividualA
## 1         maternal sib                      2.0                       0.4
## 2         maternal sib                      2.0                       0.3
## 3     maternal non-kin                      4.9                       0.7
## 4     maternal non-kin                      4.9                       0.7
## 5     maternal non-kin                      3.0                       0.6
## 6     maternal non-kin                      3.0                       0.5
##   DominanceRank_IndB Centrality_IndividualA Centrality_IndividualB
## 1                  0                  0.742                  0.705
## 2                  0                  0.838                  0.866
## 3                  0                  0.845                  0.705
## 4                  0                  0.887                  0.866
## 5                  0                  0.758                  0.705
## 6                  0                  0.875                  0.866
##   PresenceMaleInfant_IndividualA PresenceFemaleInfant_IndividualA
## 1                              0                                1
## 2                              0                                0
## 3                              0                                0
## 4                              0                                0
## 5                              0                                0
## 6                              0                                0
##   PresenceMaleInfant_IndividualB PresenceFemaleInfant_IndividualB
## 1                              0                                0
## 2                              0                                0
## 3                              0                                0
## 4                              0                                0
## 5                              0                                0
## 6                              0                                0
names(d) #Having the names spelled out like this will help us with our model later!
##  [1] "Group_ID"                         "Dyad_ID"                         
##  [3] "IndividualA_ID"                   "IndividualB_ID"                  
##  [5] "Year"                             "DSI"                             
##  [7] "RValue_Dyad"                      "KinshipCategory_Dyad"            
##  [9] "AgeDifference_years_Dyad"         "DominanceRank_IndividualA"       
## [11] "DominanceRank_IndB"               "Centrality_IndividualA"          
## [13] "Centrality_IndividualB"           "PresenceMaleInfant_IndividualA"  
## [15] "PresenceFemaleInfant_IndividualA" "PresenceMaleInfant_IndividualB"  
## [17] "PresenceFemaleInfant_IndividualB"
#For future reference, remember that we are calling our data 'd'.
df <-read.delim2("https://raw.githubusercontent.com/ZoeEAlbert/zalbert-data-replication-assignment/main/Kalbitzer_et_al_capuchin_sociality_dyadic_data.csv")

Female social bonds vary between and within dyads. The coefficient of variation was 86% between dyads and 67% within the same dyad over time. The variation in bond strength both within and between dyads is significantly related to three of the tested variables;

  1. Relatedness (R-Value)

  2. Dominance rank difference

  3. Presence of female infants

Predictors of Dyadic Bond Strength

The first thing we are going to do is replicate the first table in the paper. Table 1 illustrates the following predictors of dyadic bond strength: R-value, Age difference, Rank difference, Male infant present, Female infant present.

I started by putting the data into a data frame so I could get a better look at it in r. I won’t really need to use this further.

library(curl)
f1<-curl("https://raw.githubusercontent.com/ZoeEAlbert/zalbert-data-replication-assignment/main/Data%202.csv")
d1 <- read.csv(f1, header = TRUE, sep = ",", stringsAsFactors = FALSE)
head(d1)
##   IndividualA_ID IndividualB_ID Year   DSI       Log RValue_Dyad
## 1              2              1 2010 1.244 0.1283993       0.062
## 2              2              1 2011 2.602 0.4316853       0.062
## 3              8              1 2010 1.387 0.1723110       0.000
## 4              8              1 2011 1.531 0.2124540       0.000
## 5             11              1 2010 1.336 0.1571544       0.000
## 6             11              1 2011 1.298 0.1455072       0.000
##   KinshipCategory_Dyad AgeDifference_years_Dyad DominanceRank_IndividualA
## 1         maternal sib                      2.0                       0.4
## 2         maternal sib                      2.0                       0.3
## 3     maternal non-kin                      4.9                       0.7
## 4     maternal non-kin                      4.9                       0.7
## 5     maternal non-kin                      3.0                       0.6
## 6     maternal non-kin                      3.0                       0.5
##   DominanceRank_IndB Rank.Difference Centrality_IndividualA
## 1                  0             0.4                  0.742
## 2                  0             0.3                  0.838
## 3                  0             0.7                  0.845
## 4                  0             0.7                  0.887
## 5                  0             0.6                  0.758
## 6                  0             0.5                  0.875
##   Centrality_IndividualB PresenceMaleInfant_IndividualA
## 1                  0.705                              0
## 2                  0.866                              0
## 3                  0.705                              0
## 4                  0.866                              0
## 5                  0.705                              0
## 6                  0.866                              0
##   PresenceFemaleInfant_IndividualA PresenceMaleInfant_IndividualB
## 1                                1                              0
## 2                                0                              0
## 3                                0                              0
## 4                                0                              0
## 5                                0                              0
## 6                                0                              0
##   PresenceFemaleInfant_IndividualB Male.Infant.Present Female.Infant.Present
## 1                                0                   0                     1
## 2                                0                   0                     0
## 3                                0                   0                     0
## 4                                0                   0                     0
## 5                                0                   0                     0
## 6                                0                   0                     0
names(d1)
##  [1] "IndividualA_ID"                   "IndividualB_ID"                  
##  [3] "Year"                             "DSI"                             
##  [5] "Log"                              "RValue_Dyad"                     
##  [7] "KinshipCategory_Dyad"             "AgeDifference_years_Dyad"        
##  [9] "DominanceRank_IndividualA"        "DominanceRank_IndB"              
## [11] "Rank.Difference"                  "Centrality_IndividualA"          
## [13] "Centrality_IndividualB"           "PresenceMaleInfant_IndividualA"  
## [15] "PresenceFemaleInfant_IndividualA" "PresenceMaleInfant_IndividualB"  
## [17] "PresenceFemaleInfant_IndividualB" "Male.Infant.Present"             
## [19] "Female.Infant.Present"
df2 <- curl("https://raw.githubusercontent.com/ZoeEAlbert/zalbert-data-replication-assignment/main/Data%202.csv")
df2 <- read.csv(df2, header = TRUE, sep = ",", stringsAsFactors = FALSE)
names(df2)
##  [1] "IndividualA_ID"                   "IndividualB_ID"                  
##  [3] "Year"                             "DSI"                             
##  [5] "Log"                              "RValue_Dyad"                     
##  [7] "KinshipCategory_Dyad"             "AgeDifference_years_Dyad"        
##  [9] "DominanceRank_IndividualA"        "DominanceRank_IndB"              
## [11] "Rank.Difference"                  "Centrality_IndividualA"          
## [13] "Centrality_IndividualB"           "PresenceMaleInfant_IndividualA"  
## [15] "PresenceFemaleInfant_IndividualA" "PresenceMaleInfant_IndividualB"  
## [17] "PresenceFemaleInfant_IndividualB" "Male.Infant.Present"             
## [19] "Female.Infant.Present"
library(lme4) #Now, let's go to the library to get the package (lme4) that we need. 
lmm <- lmer(data = df2, Log ~ (Rank.Difference) +  (1 | AgeDifference_years_Dyad) + (1 | RValue_Dyad) + (1 | Male.Infant.Present) + (1 | Female.Infant.Present)) #THIS ISNT QUITE RIGHT YET. 
summary(lmm)
## Linear mixed model fit by REML ['lmerMod']
## Formula: Log ~ (Rank.Difference) + (1 | AgeDifference_years_Dyad) + (1 |  
##     RValue_Dyad) + (1 | Male.Infant.Present) + (1 | Female.Infant.Present)
##    Data: df2
## 
## REML criterion at convergence: 411.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.9295 -0.6148  0.1022  0.6767  2.3958 
## 
## Random effects:
##  Groups                   Name        Variance  Std.Dev. 
##  RValue_Dyad              (Intercept) 2.711e-02 1.646e-01
##  AgeDifference_years_Dyad (Intercept) 7.759e-03 8.809e-02
##  Female.Infant.Present    (Intercept) 4.480e-03 6.693e-02
##  Male.Infant.Present      (Intercept) 3.304e-10 1.818e-05
##  Residual                             1.016e-01 3.188e-01
## Number of obs: 557, groups:  
## RValue_Dyad, 100; AgeDifference_years_Dyad, 94; Female.Infant.Present, 2; Male.Infant.Present, 2
## 
## Fixed effects:
##                 Estimate Std. Error t value
## (Intercept)      0.05047    0.06243   0.808
## Rank.Difference -0.36811    0.06921  -5.319
## 
## Correlation of Fixed Effects:
##             (Intr)
## Rank.Dffrnc -0.499
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
coefficients(lmm)
## $RValue_Dyad
##         (Intercept) Rank.Difference
## 0      0.0253156459      -0.3681066
## 0.003  0.0510258281      -0.3681066
## 0.004  0.0917725187      -0.3681066
## 0.005  0.0177944134      -0.3681066
## 0.015  0.1526431700      -0.3681066
## 0.018  0.0689193941      -0.3681066
## 0.02   0.0220253519      -0.3681066
## 0.022 -0.0718477195      -0.3681066
## 0.026  0.0527625790      -0.3681066
## 0.029  0.0775924471      -0.3681066
## 0.031  0.1083962072      -0.3681066
## 0.034 -0.2056621962      -0.3681066
## 0.035 -0.0918743005      -0.3681066
## 0.036  0.0844696071      -0.3681066
## 0.038  0.0550097361      -0.3681066
## 0.047 -0.0775439921      -0.3681066
## 0.048  0.0747146305      -0.3681066
## 0.049  0.0117550343      -0.3681066
## 0.052 -0.0009355586      -0.3681066
## 0.056  0.0350363158      -0.3681066
## 0.06   0.0928215907      -0.3681066
## 0.061 -0.1642616967      -0.3681066
## 0.062  0.1532524131      -0.3681066
## 0.068 -0.2645357246      -0.3681066
## 0.069 -0.0148447648      -0.3681066
## 0.07   0.1329081240      -0.3681066
## 0.075 -0.0308357473      -0.3681066
## 0.076 -0.0979191734      -0.3681066
## 0.077  0.1118331728      -0.3681066
## 0.078  0.0717085058      -0.3681066
## 0.083 -0.1175529230      -0.3681066
## 0.09   0.1041734313      -0.3681066
## 0.091  0.0660077898      -0.3681066
## 0.094  0.0540334111      -0.3681066
## 0.096  0.0152448894      -0.3681066
## 0.099 -0.0384315962      -0.3681066
## 0.102  0.1008290325      -0.3681066
## 0.105  0.1558556522      -0.3681066
## 0.113 -0.0775125011      -0.3681066
## 0.123 -0.0120857810      -0.3681066
## 0.128  0.2215828770      -0.3681066
## 0.131  0.0812623790      -0.3681066
## 0.132  0.0387221783      -0.3681066
## 0.136  0.0462341078      -0.3681066
## 0.154  0.1097739159      -0.3681066
## 0.161  0.1176310972      -0.3681066
## 0.164  0.2170057013      -0.3681066
## 0.166 -0.0274773616      -0.3681066
## 0.172  0.0948282896      -0.3681066
## 0.173 -0.0791433167      -0.3681066
## 0.175  0.0575112038      -0.3681066
## 0.179 -0.0815394350      -0.3681066
## 0.181 -0.0267895255      -0.3681066
## 0.186  0.0307663941      -0.3681066
## 0.195 -0.0087558274      -0.3681066
## 0.204  0.0420733377      -0.3681066
## 0.212  0.1737206099      -0.3681066
## 0.213  0.2326385947      -0.3681066
## 0.221 -0.0444062197      -0.3681066
## 0.242 -0.0810321215      -0.3681066
## 0.247  0.0373468435      -0.3681066
## 0.27   0.2003605943      -0.3681066
## 0.273 -0.0523472748      -0.3681066
## 0.274  0.0452044692      -0.3681066
## 0.3   -0.0020814332      -0.3681066
## 0.306  0.1831377169      -0.3681066
## 0.31  -0.0858504495      -0.3681066
## 0.325  0.0313849470      -0.3681066
## 0.328  0.0894080958      -0.3681066
## 0.331 -0.1594613063      -0.3681066
## 0.335  0.0591718580      -0.3681066
## 0.342 -0.0426950994      -0.3681066
## 0.35  -0.1341030632      -0.3681066
## 0.351  0.1136650115      -0.3681066
## 0.37  -0.0548708086      -0.3681066
## 0.373  0.0790289653      -0.3681066
## 0.39   0.0734034117      -0.3681066
## 0.391  0.0860343074      -0.3681066
## 0.406  0.0957326597      -0.3681066
## 0.409 -0.1671255878      -0.3681066
## 0.413  0.0968515726      -0.3681066
## 0.443  0.0974851128      -0.3681066
## 0.454  0.0302147119      -0.3681066
## 0.457  0.2947066752      -0.3681066
## 0.471  0.3201416218      -0.3681066
## 0.482  0.1419905539      -0.3681066
## 0.487  0.1162292248      -0.3681066
## 0.497  0.1736328021      -0.3681066
## 0.5    0.1917241599      -0.3681066
## 0.507  0.1449765045      -0.3681066
## 0.513  0.0511998669      -0.3681066
## 0.519  0.1874206952      -0.3681066
## 0.524  0.1135111992      -0.3681066
## 0.531  0.0851756352      -0.3681066
## 0.534  0.0176128788      -0.3681066
## 0.565  0.1062963643      -0.3681066
## 0.567  0.2160984647      -0.3681066
## 0.572  0.2431323705      -0.3681066
## 0.642  0.2299407513      -0.3681066
## 0.648 -0.0429808833      -0.3681066
## 
## $AgeDifference_years_Dyad
##        (Intercept) Rank.Difference
## 0     0.0658439969      -0.3681066
## 0.2   0.0029752661      -0.3681066
## 0.4   0.0717961689      -0.3681066
## 0.5   0.0133738061      -0.3681066
## 0.6   0.0461268617      -0.3681066
## 0.8   0.0471100854      -0.3681066
## 0.9   0.0904508353      -0.3681066
## 1     0.0873376829      -0.3681066
## 1.1   0.0233164988      -0.3681066
## 1.2  -0.0118090897      -0.3681066
## 1.3   0.0430331733      -0.3681066
## 1.5   0.0272157259      -0.3681066
## 1.6   0.0423310039      -0.3681066
## 1.8   0.0680364212      -0.3681066
## 1.9  -0.0005387029      -0.3681066
## 2     0.1134733992      -0.3681066
## 2.1   0.0637965887      -0.3681066
## 2.2   0.1323115540      -0.3681066
## 2.3   0.0803132632      -0.3681066
## 2.4   0.1056177881      -0.3681066
## 2.5   0.1046011052      -0.3681066
## 2.7   0.0239776053      -0.3681066
## 2.8   0.0651885636      -0.3681066
## 3     0.1278672835      -0.3681066
## 3.2   0.0628076361      -0.3681066
## 3.4   0.0452178257      -0.3681066
## 3.6   0.0114540440      -0.3681066
## 3.7   0.0286902757      -0.3681066
## 3.8   0.0517720231      -0.3681066
## 4     0.0706657789      -0.3681066
## 4.1   0.0238062676      -0.3681066
## 4.2  -0.0228393049      -0.3681066
## 4.3  -0.0160955370      -0.3681066
## 4.5   0.0440078045      -0.3681066
## 4.6   0.0610096013      -0.3681066
## 4.7   0.0115539850      -0.3681066
## 4.8   0.0270638810      -0.3681066
## 4.9   0.0933521261      -0.3681066
## 5.1   0.0364674711      -0.3681066
## 5.3   0.1077044635      -0.3681066
## 5.6   0.0629717029      -0.3681066
## 5.7   0.0674470064      -0.3681066
## 6     0.1084847978      -0.3681066
## 6.1   0.1243934028      -0.3681066
## 6.2   0.0752902776      -0.3681066
## 6.5   0.0933753537      -0.3681066
## 6.7   0.0201687057      -0.3681066
## 6.8   0.0148662061      -0.3681066
## 6.9   0.1365447712      -0.3681066
## 7     0.0219995119      -0.3681066
## 7.1   0.0982297826      -0.3681066
## 7.8   0.0692946897      -0.3681066
## 8    -0.1043173411      -0.3681066
## 8.1   0.0267422422      -0.3681066
## 8.2   0.0460550923      -0.3681066
## 8.4   0.0380118133      -0.3681066
## 8.7   0.0034794923      -0.3681066
## 8.9   0.0859143512      -0.3681066
## 9.1   0.0657116017      -0.3681066
## 9.2   0.0138405894      -0.3681066
## 9.6  -0.0322352087      -0.3681066
## 10    0.1006861926      -0.3681066
## 10.1  0.0265640406      -0.3681066
## 10.3  0.0797173416      -0.3681066
## 10.9  0.0056782113      -0.3681066
## 11.1  0.0806368405      -0.3681066
## 11.6  0.0272007336      -0.3681066
## 11.9  0.0602042317      -0.3681066
## 12    0.0796245851      -0.3681066
## 12.5  0.0604063159      -0.3681066
## 12.7  0.0357589729      -0.3681066
## 12.9  0.0148350876      -0.3681066
## 13.2  0.0572076794      -0.3681066
## 13.4  0.0843932680      -0.3681066
## 13.7  0.0023799422      -0.3681066
## 13.9  0.0042207994      -0.3681066
## 14    0.0579723771      -0.3681066
## 14.1  0.0403902530      -0.3681066
## 14.5  0.0857502726      -0.3681066
## 14.7  0.0354309927      -0.3681066
## 14.8  0.0432695080      -0.3681066
## 14.9  0.0097298556      -0.3681066
## 15.6  0.0928980509      -0.3681066
## 15.9  0.0670526691      -0.3681066
## 16    0.0398148627      -0.3681066
## 16.1  0.0514925726      -0.3681066
## 16.5  0.0582358032      -0.3681066
## 16.6  0.0685167176      -0.3681066
## 16.7  0.0100888838      -0.3681066
## 16.9  0.0685607428      -0.3681066
## 17.1  0.0574120946      -0.3681066
## 18.1  0.0131512047      -0.3681066
## 18.9  0.0775229354      -0.3681066
## 20.3  0.0410680353      -0.3681066
## 
## $Female.Infant.Present
##   (Intercept) Rank.Difference
## 0 0.005475775      -0.3681066
## 1 0.095471590      -0.3681066
## 
## $Male.Infant.Present
##   (Intercept) Rank.Difference
## 0  0.05047367      -0.3681066
## 1  0.05047369      -0.3681066
## 
## attr(,"class")
## [1] "coef.mer"
full <- lmer(data = df2, Log ~ (Rank.Difference) +  (1 | AgeDifference_years_Dyad) + (1 | RValue_Dyad) + (1 | Male.Infant.Present) + (1 | Female.Infant.Present), REML = FALSE)
reduced <- lmer(data = df2, Log ~ (Rank.Difference) + (1 | AgeDifference_years_Dyad), REML = FALSE)
#The authors DO NOT specify what goes in the reduced vs. the full. 
anova(reduced, full, test = "Chisq")
## Data: df2
## Models:
## reduced: Log ~ (Rank.Difference) + (1 | AgeDifference_years_Dyad)
## full: Log ~ (Rank.Difference) + (1 | AgeDifference_years_Dyad) + (1 | RValue_Dyad) + (1 | Male.Infant.Present) + (1 | Female.Infant.Present)
##         npar    AIC    BIC  logLik deviance  Chisq Df Pr(>Chisq)    
## reduced    4 434.48 451.77 -213.24   426.48                         
## full       7 418.01 448.27 -202.01   404.01 22.469  3   5.21e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Because the random effects were not specified, this was a very long process of trial and error....  I feel confident that log should be before ~
#I JUST DON'T UNDERSTAND WHY THEY DIDN'T JUST WRITE THEM DOWN.
#It was at this point that I contacted everyone I have ever known or been in contact with who might have known how to use r...I am getting numbers they are just the wrong numbers.
#All of this runs, which I am very proud of, but until I can get info from the authors about which are the random effects I am not in hot shape. 

I believe that the authors took their data from R and then made a pretty table on excel. So, that is what I did. As a point of reference, here is what it should look like, based upon the paper. I believe they accomplished this in excel. Table 1, (Zoe’s Version) Table 1, as seen in the original paper

Dyadic bond strength among different kin categories

The next thing that I wanted to replicate was the first figure from the paper. This figure shows the dyadic bond strength of each of five kinship categories (mother-offspring, full sib, maternal sib, paternal sib, non-kin). It is REALLY important to copy these categories EXACTLY as they appear in the excel sheet rather than how they appear in the figures.

#First, let's try using baseplot.  It makes sense to start with this since it is the basic package. 
str(d)
## 'data.frame':    557 obs. of  17 variables:
##  $ Group_ID                        : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Dyad_ID                         : int  1 1 2 2 3 3 4 4 5 5 ...
##  $ IndividualA_ID                  : int  2 2 8 8 11 11 18 18 26 26 ...
##  $ IndividualB_ID                  : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Year                            : int  2010 2011 2010 2011 2010 2011 2010 2011 2010 2011 ...
##  $ DSI                             : num  1.24 2.6 1.39 1.53 1.34 ...
##  $ RValue_Dyad                     : num  0.062 0.062 0 0 0 0 0.221 0.221 0.07 0.07 ...
##  $ KinshipCategory_Dyad            : chr  "maternal sib" "maternal sib" "maternal non-kin" "maternal non-kin" ...
##  $ AgeDifference_years_Dyad        : num  2 2 4.9 4.9 3 3 1.1 1.1 4.3 4.3 ...
##  $ DominanceRank_IndividualA       : num  0.4 0.3 0.7 0.7 0.6 0.5 0.1 0.6 0.9 0.9 ...
##  $ DominanceRank_IndB              : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ Centrality_IndividualA          : num  0.742 0.838 0.845 0.887 0.758 0.875 0.921 0.887 0.951 0.929 ...
##  $ Centrality_IndividualB          : num  0.705 0.866 0.705 0.866 0.705 0.866 0.705 0.866 0.705 0.866 ...
##  $ PresenceMaleInfant_IndividualA  : int  0 0 0 0 0 0 1 1 0 1 ...
##  $ PresenceFemaleInfant_IndividualA: int  1 0 0 0 0 0 0 0 0 0 ...
##  $ PresenceMaleInfant_IndividualB  : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ PresenceFemaleInfant_IndividualB: int  0 0 0 0 0 0 0 0 0 0 ...
d[8]<-as.factor(d$KinshipCategory_Dyad)
DSI<- log(d$DSI+.1)
plot(d$KinshipCategory_Dyad, log(d$DSI+.1))

#After some trial and error, I learned that I could add the log and .1 in r, and don't have to go back to excel to do so.  I appreciate that a lot. 

This looks okay, but I think we can make it look better!

#Next, let's try the same thing but with ggplot to make things a bit more fanciful, and true to the published paper.  By using this package, we are able to add boxes, points, themes and more.  
library(ggplot2) #Let's invite ggplot to the party. 
library(ggsignif)
library(magrittr)
levels(d$KinshipCategory_Dyad) #The levels function will make sure that my categories can appear in the order I want them to. 
## [1] "Excluded from model testing for effect of kinship categories"
## [2] "full sib"                                                    
## [3] "maternal non-kin"                                            
## [4] "maternal sib"                                                
## [5] "mother-offspring"                                            
## [6] "paternal sib"
d$KinshipCategory_Dyad <-factor(d$KinshipCategory_Dyad, levels = c( "mother-offspring", "full sib", "maternal sib", "paternal sib", "maternal non-kin", "Excluded from model testing for effect of kinship categories" )) #I have to list the categories as they appear on the excel document. 
levels(d$KinshipCategory_Dyad)
## [1] "mother-offspring"                                            
## [2] "full sib"                                                    
## [3] "maternal sib"                                                
## [4] "paternal sib"                                                
## [5] "maternal non-kin"                                            
## [6] "Excluded from model testing for effect of kinship categories"
#Please note that after running this code, my kinship categories were not in the same order as they appear in the presented figure.  To fix the order, I used the levels function.
ggplot(data = d, mapping = aes(x = KinshipCategory_Dyad, y = log(d$DSI+.1)))+geom_boxplot(data = d)+geom_jitter(data=d)+theme_bw()+ geom_signif(comparisons = list("mother-offspring", "full sib", "maternal sib", "paternal sib", "non-kin", "Excluded from model testing for effect of kinship categories"), map_signif_level=TRUE)+ theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"))

#Bellow is the code that Dr. Schmitt and I worked on together in office hours.  Unfortunately, when I got home, this code would no longer run nor would it exclude the category "Excluded from model testing for effect of kinship categories".
    #ggplot(data = d %>% filter(KinshipCategory_Dyad != "Excluded from model testing for effect of kinship categories"), mapping = aes(x x = = KinshipCategory_Dyad, y = log(DSI+.1)))+ geom_boxplot(data = d %>% filter(KinshipCategory_Dyad != "Excluded from model testing for effect of kinship categories")) + geom_jitter(data=d %>% filter(KinshipCategory_Dyad != "Excluded from model testing for effect of kinship categories")) + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), axis.line = element_line(colour = "black"))

#I found geom_jitter online and it worked to make sure my points didn't just show up in a straight line!
# We had to manually exclude one of the categories called "Excluded from model testing for effect of kinship categories". I ran into SO many issues because I accidentally was calling one of the categories the wrong name and so it wasn't showing up. 
#We also, still want to add the significance.  I have tried many different means of doing this.  I think I need to do each one manually, using code found [here](https://cran.r-project.org/web/packages/ggsignif/vignettes/intro.html).  This code does not produce the same kind of lines that I am looking for, I think this must have been accomplished using Photoshop. 

Based upon the published paper, here is what the graph should actually look like The graph that we produced looks pretty good compared to the graph that the author’s submitted.

Rank of a Group, Measured Over Years

This graph, which is one of six, shows the rank of individuals in group one over the time span: 2005-2011.

#Because the data on dyad was incomplete, I first had to do some data manipulation.  And boy are my arms tired. 
group1<- subset(d, Group_ID == 1)
group1
##     Group_ID Dyad_ID IndividualA_ID IndividualB_ID Year   DSI RValue_Dyad
## 1          1       1              2              1 2010 1.244       0.062
## 2          1       1              2              1 2011 2.602       0.062
## 3          1       2              8              1 2010 1.387       0.000
## 4          1       2              8              1 2011 1.531       0.000
## 5          1       3             11              1 2010 1.336       0.000
## 6          1       3             11              1 2011 1.298       0.000
## 7          1       4             18              1 2010 0.213       0.221
## 8          1       4             18              1 2011 0.355       0.221
## 9          1       5             26              1 2010 1.050       0.070
## 10         1       5             26              1 2011 0.325       0.070
## 11         1       6             27              1 2010 1.034       0.031
## 12         1       6             27              1 2011 1.592       0.031
## 13         1       7             28              1 2010 0.381       0.000
## 14         1       7             28              1 2011 0.466       0.000
## 15         1       8             29              1 2010 0.000       0.022
## 16         1       8             29              1 2011 0.299       0.022
## 17         1       9             30              1 2010 2.897       0.519
## 18         1       9             30              1 2011 1.051       0.519
## 19         1      10             32              1 2010 2.290       0.172
## 20         1      10             32              1 2011 0.571       0.172
## 21         1      11              8              2 2009 3.328       0.406
## 22         1      11              8              2 2010 0.307       0.406
## 23         1      11              8              2 2011 1.372       0.406
## 24         1      12             11              2 2009 4.510       0.123
## 25         1      12             11              2 2010 0.377       0.123
## 26         1      12             11              2 2011 0.502       0.123
## 27         1      13             18              2 2009 1.792       0.000
## 28         1      13             18              2 2010 1.114       0.000
## 29         1      13             18              2 2011 0.797       0.000
## 30         1      14             26              2 2009 3.389       0.000
## 31         1      14             26              2 2010 0.681       0.000
## 32         1      14             26              2 2011 0.260       0.000
## 33         1      15             27              2 2009 0.103       0.350
## 34         1      15             27              2 2010 0.620       0.350
## 35         1      15             27              2 2011 0.241       0.350
## 36         1      16             28              2 2009 3.626       0.000
## 37         1      16             28              2 2010 0.320       0.000
## 38         1      16             28              2 2011 0.379       0.000
## 39         1      17             29              2 2009 1.694       0.000
## 40         1      17             29              2 2010 0.075       0.000
## 41         1      17             29              2 2011 0.116       0.000
## 42         1      18             30              2 2009 0.716       0.500
## 43         1      18             30              2 2010 0.553       0.500
## 44         1      18             30              2 2011 1.993       0.500
## 45         1      19             32              2 2009 0.000       0.034
## 46         1      19             32              2 2010 0.075       0.034
## 47         1      19             32              2 2011 0.497       0.034
## 155        1      52             11              8 2007 3.071       0.642
## 156        1      52             11              8 2008 1.471       0.642
## 157        1      52             11              8 2009 1.859       0.642
## 158        1      52             11              8 2010 0.672       0.642
## 159        1      52             11              8 2011 3.574       0.642
## 160        1      53             18              8 2009 0.106       0.038
## 161        1      53             18              8 2010 2.113       0.038
## 162        1      53             18              8 2011 0.767       0.038
## 163        1      54             26              8 2006 0.655       0.000
## 164        1      54             26              8 2007 1.793       0.000
## 165        1      54             26              8 2008 1.244       0.000
## 166        1      54             26              8 2009 0.292       0.000
## 167        1      54             26              8 2010 0.853       0.000
## 168        1      54             26              8 2011 0.376       0.000
## 169        1      55             27              8 2005 0.236       0.000
## 170        1      55             27              8 2006 2.314       0.000
## 171        1      55             27              8 2007 0.606       0.000
## 172        1      55             27              8 2008 1.621       0.000
## 173        1      55             27              8 2009 0.000       0.000
## 174        1      55             27              8 2010 0.440       0.000
## 175        1      55             27              8 2011 0.276       0.000
## 176        1      56             28              8 2009 1.594       0.000
## 177        1      56             28              8 2010 1.845       0.000
## 178        1      56             28              8 2011 0.332       0.000
## 179        1      57             29              8 2005 0.415       0.077
## 180        1      57             29              8 2006 0.997       0.077
## 181        1      57             29              8 2007 2.026       0.077
## 182        1      57             29              8 2008 1.121       0.077
## 183        1      57             29              8 2009 1.076       0.077
## 184        1      57             29              8 2010 0.606       0.077
## 185        1      57             29              8 2011 0.689       0.077
## 186        1      58             30              8 2005 1.642       0.000
## 187        1      58             30              8 2006 0.537       0.000
## 188        1      58             30              8 2007 0.637       0.000
## 189        1      58             30              8 2008 0.857       0.000
## 190        1      58             30              8 2009 0.492       0.000
## 191        1      58             30              8 2010 0.743       0.000
## 192        1      58             30              8 2011 2.778       0.000
## 193        1      59             32              8 2005 0.349       0.061
## 194        1      59             32              8 2006 0.593       0.061
## 195        1      59             32              8 2007 0.126       0.061
## 196        1      59             32              8 2008 0.225       0.061
## 197        1      59             32              8 2009 0.413       0.061
## 198        1      59             32              8 2010 0.147       0.061
## 199        1      59             32              8 2011 0.447       0.061
## 256        1      74             18             11 2009 0.455       0.000
## 257        1      74             18             11 2010 1.181       0.000
## 258        1      74             18             11 2011 0.326       0.000
## 259        1      75             26             11 2007 0.742       0.004
## 260        1      75             26             11 2008 0.926       0.004
## 261        1      75             26             11 2009 0.883       0.004
## 262        1      75             26             11 2010 0.785       0.004
## 263        1      75             26             11 2011 0.330       0.004
## 264        1      76             27             11 2007 0.258       0.061
## 265        1      76             27             11 2008 0.985       0.061
## 266        1      76             27             11 2009 0.194       0.061
## 267        1      76             27             11 2010 0.822       0.061
## 268        1      76             27             11 2011 0.000       0.061
## 269        1      77             28             11 2009 1.087       0.132
## 270        1      77             28             11 2010 0.232       0.132
## 271        1      77             28             11 2011 1.178       0.132
## 272        1      78             29             11 2007 2.173       0.164
## 273        1      78             29             11 2008 1.147       0.164
## 274        1      78             29             11 2009 0.398       0.164
## 275        1      78             29             11 2010 0.973       0.164
## 276        1      78             29             11 2011 1.875       0.164
## 277        1      79             30             11 2007 0.946       0.000
## 278        1      79             30             11 2008 0.686       0.000
## 279        1      79             30             11 2009 0.106       0.000
## 280        1      79             30             11 2010 0.489       0.000
## 281        1      79             30             11 2011 1.549       0.000
## 282        1      80             32             11 2007 0.868       0.047
## 283        1      80             32             11 2008 0.183       0.047
## 284        1      80             32             11 2009 0.106       0.047
## 285        1      80             32             11 2010 0.516       0.047
## 286        1      80             32             11 2011 0.651       0.047
## 434        1     120             26             18 2009 0.651       0.128
## 435        1     120             26             18 2010 2.211       0.128
## 436        1     120             26             18 2011 1.624       0.128
## 437        1     121             27             18 2009 0.390       0.500
## 438        1     121             27             18 2010 1.528       0.500
## 439        1     121             27             18 2011 1.521       0.500
## 440        1     122             28             18 2009 0.103       0.131
## 441        1     122             28             18 2010 2.267       0.131
## 442        1     122             28             18 2011 1.092       0.131
## 443        1     123             29             18 2009 0.000       0.274
## 444        1     123             29             18 2010 2.687       0.274
## 445        1     123             29             18 2011 0.900       0.274
## 446        1     124             30             18 2009 0.437       0.487
## 447        1     124             30             18 2010 1.344       0.487
## 448        1     124             30             18 2011 1.649       0.487
## 449        1     125             32             18 2009 0.332       0.274
## 450        1     125             32             18 2010 2.760       0.274
## 451        1     125             32             18 2011 0.164       0.274
## 477        1     137             27             26 2006 1.604       0.075
## 478        1     137             27             26 2007 0.041       0.075
## 479        1     137             27             26 2008 0.970       0.075
## 480        1     137             27             26 2009 0.284       0.075
## 481        1     137             27             26 2010 0.300       0.075
## 482        1     137             27             26 2011 0.209       0.075
## 483        1     138             28             26 2009 3.068       0.497
## 484        1     138             28             26 2010 1.406       0.497
## 485        1     138             28             26 2011 1.716       0.497
## 486        1     139             29             26 2006 0.909       0.572
## 487        1     139             29             26 2007 1.628       0.572
## 488        1     139             29             26 2008 2.020       0.572
## 489        1     139             29             26 2009 2.362       0.572
## 490        1     139             29             26 2010 2.617       0.572
## 491        1     139             29             26 2011 5.320       0.572
## 492        1     140             30             26 2006 0.771       0.000
## 493        1     140             30             26 2007 1.597       0.000
## 494        1     140             30             26 2008 0.733       0.000
## 495        1     140             30             26 2009 0.255       0.000
## 496        1     140             30             26 2010 0.279       0.000
## 497        1     140             30             26 2011 0.000       0.000
## 498        1     141             32             26 2006 0.956       0.331
## 499        1     141             32             26 2007 0.121       0.331
## 500        1     141             32             26 2008 0.544       0.331
## 501        1     141             32             26 2009 0.000       0.331
## 502        1     141             32             26 2010 0.000       0.331
## 503        1     141             32             26 2011 0.061       0.331
## 504        1     142             28             27 2009 0.000       0.083
## 505        1     142             28             27 2010 0.224       0.083
## 506        1     142             28             27 2011 0.461       0.083
## 507        1     143             29             27 2005 0.123       0.113
## 508        1     143             29             27 2006 1.093       0.113
## 509        1     143             29             27 2007 0.261       0.113
## 510        1     143             29             27 2008 1.576       0.113
## 511        1     143             29             27 2009 0.097       0.113
## 512        1     143             29             27 2010 0.000       0.113
## 513        1     143             29             27 2011 0.109       0.113
## 514        1     144             30             27 2005 1.474       0.567
## 515        1     144             30             27 2006 1.591       0.567
## 516        1     144             30             27 2007 1.371       0.567
## 517        1     144             30             27 2008 1.127       0.567
## 518        1     144             30             27 2009 1.815       0.567
## 519        1     144             30             27 2010 3.068       0.567
## 520        1     144             30             27 2011 2.209       0.567
## 521        1     145             32             27 2005 0.920       0.500
## 522        1     145             32             27 2006 0.921       0.500
## 523        1     145             32             27 2007 0.704       0.500
## 524        1     145             32             27 2008 1.512       0.500
## 525        1     145             32             27 2009 0.887       0.500
## 526        1     145             32             27 2010 0.102       0.500
## 527        1     145             32             27 2011 0.578       0.500
## 528        1     146             29             28 2009 2.469       0.457
## 529        1     146             29             28 2010 2.779       0.457
## 530        1     146             29             28 2011 4.340       0.457
## 531        1     147             30             28 2009 0.810       0.123
## 532        1     147             30             28 2010 0.473       0.123
## 533        1     147             30             28 2011 0.058       0.123
## 534        1     148             32             28 2009 0.207       0.342
## 535        1     148             32             28 2010 0.518       0.342
## 536        1     148             32             28 2011 0.122       0.342
## 537        1     149             30             29 2005 3.109       0.102
## 538        1     149             30             29 2006 1.125       0.102
## 539        1     149             30             29 2007 1.068       0.102
## 540        1     149             30             29 2008 1.303       0.102
## 541        1     149             30             29 2009 1.407       0.102
## 542        1     149             30             29 2010 0.390       0.102
## 543        1     149             30             29 2011 0.597       0.102
## 544        1     150             32             29 2005 0.237       0.173
## 545        1     150             32             29 2006 0.479       0.173
## 546        1     150             32             29 2007 0.085       0.173
## 547        1     150             32             29 2008 0.226       0.173
## 548        1     150             32             29 2009 0.107       0.173
## 549        1     150             32             29 2010 0.370       0.173
## 550        1     150             32             29 2011 0.338       0.173
## 551        1     151             32             30 2005 1.493       0.565
## 552        1     151             32             30 2006 0.454       0.565
## 553        1     151             32             30 2007 0.879       0.565
## 554        1     151             32             30 2008 0.522       0.565
## 555        1     151             32             30 2009 1.098       0.565
## 556        1     151             32             30 2010 1.306       0.565
## 557        1     151             32             30 2011 0.535       0.565
##                                             KinshipCategory_Dyad
## 1                                                   maternal sib
## 2                                                   maternal sib
## 3                                               maternal non-kin
## 4                                               maternal non-kin
## 5                                               maternal non-kin
## 6                                               maternal non-kin
## 7                                               maternal non-kin
## 8                                               maternal non-kin
## 9                                               maternal non-kin
## 10                                              maternal non-kin
## 11  Excluded from model testing for effect of kinship categories
## 12  Excluded from model testing for effect of kinship categories
## 13                                              maternal non-kin
## 14                                              maternal non-kin
## 15                                              maternal non-kin
## 16                                              maternal non-kin
## 17                                              mother-offspring
## 18                                              mother-offspring
## 19                                              maternal non-kin
## 20                                              maternal non-kin
## 21                                                  paternal sib
## 22                                                  paternal sib
## 23                                                  paternal sib
## 24                                                  paternal sib
## 25                                                  paternal sib
## 26                                                  paternal sib
## 27                                              maternal non-kin
## 28                                              maternal non-kin
## 29                                              maternal non-kin
## 30                                              maternal non-kin
## 31                                              maternal non-kin
## 32                                              maternal non-kin
## 33  Excluded from model testing for effect of kinship categories
## 34  Excluded from model testing for effect of kinship categories
## 35  Excluded from model testing for effect of kinship categories
## 36                                              maternal non-kin
## 37                                              maternal non-kin
## 38                                              maternal non-kin
## 39                                              maternal non-kin
## 40                                              maternal non-kin
## 41                                              maternal non-kin
## 42                                              mother-offspring
## 43                                              mother-offspring
## 44                                              mother-offspring
## 45                                              maternal non-kin
## 46                                              maternal non-kin
## 47                                              maternal non-kin
## 155                                                     full sib
## 156                                                     full sib
## 157                                                     full sib
## 158                                                     full sib
## 159                                                     full sib
## 160                                             maternal non-kin
## 161                                             maternal non-kin
## 162                                             maternal non-kin
## 163                                             maternal non-kin
## 164                                             maternal non-kin
## 165                                             maternal non-kin
## 166                                             maternal non-kin
## 167                                             maternal non-kin
## 168                                             maternal non-kin
## 169                                             maternal non-kin
## 170                                             maternal non-kin
## 171                                             maternal non-kin
## 172                                             maternal non-kin
## 173                                             maternal non-kin
## 174                                             maternal non-kin
## 175                                             maternal non-kin
## 176                                             maternal non-kin
## 177                                             maternal non-kin
## 178                                             maternal non-kin
## 179                                             maternal non-kin
## 180                                             maternal non-kin
## 181                                             maternal non-kin
## 182                                             maternal non-kin
## 183                                             maternal non-kin
## 184                                             maternal non-kin
## 185                                             maternal non-kin
## 186                                             maternal non-kin
## 187                                             maternal non-kin
## 188                                             maternal non-kin
## 189                                             maternal non-kin
## 190                                             maternal non-kin
## 191                                             maternal non-kin
## 192                                             maternal non-kin
## 193                                             maternal non-kin
## 194                                             maternal non-kin
## 195                                             maternal non-kin
## 196                                             maternal non-kin
## 197                                             maternal non-kin
## 198                                             maternal non-kin
## 199                                             maternal non-kin
## 256                                             maternal non-kin
## 257                                             maternal non-kin
## 258                                             maternal non-kin
## 259                                             maternal non-kin
## 260                                             maternal non-kin
## 261                                             maternal non-kin
## 262                                             maternal non-kin
## 263                                             maternal non-kin
## 264                                             maternal non-kin
## 265                                             maternal non-kin
## 266                                             maternal non-kin
## 267                                             maternal non-kin
## 268                                             maternal non-kin
## 269                                             maternal non-kin
## 270                                             maternal non-kin
## 271                                             maternal non-kin
## 272                                             maternal non-kin
## 273                                             maternal non-kin
## 274                                             maternal non-kin
## 275                                             maternal non-kin
## 276                                             maternal non-kin
## 277                                             maternal non-kin
## 278                                             maternal non-kin
## 279                                             maternal non-kin
## 280                                             maternal non-kin
## 281                                             maternal non-kin
## 282                                             maternal non-kin
## 283                                             maternal non-kin
## 284                                             maternal non-kin
## 285                                             maternal non-kin
## 286                                             maternal non-kin
## 434                                                 paternal sib
## 435                                                 paternal sib
## 436                                                 paternal sib
## 437                                             mother-offspring
## 438                                             mother-offspring
## 439                                             mother-offspring
## 440                                                 paternal sib
## 441                                                 paternal sib
## 442                                                 paternal sib
## 443                                                 paternal sib
## 444                                                 paternal sib
## 445                                                 paternal sib
## 446                                                     full sib
## 447                                                     full sib
## 448                                                     full sib
## 449                                                     full sib
## 450                                                     full sib
## 451                                                     full sib
## 477                                             maternal non-kin
## 478                                             maternal non-kin
## 479                                             maternal non-kin
## 480                                             maternal non-kin
## 481                                             maternal non-kin
## 482                                             maternal non-kin
## 483                                                 paternal sib
## 484                                                 paternal sib
## 485                                                 paternal sib
## 486                                                     full sib
## 487                                                     full sib
## 488                                                     full sib
## 489                                                     full sib
## 490                                                     full sib
## 491                                                     full sib
## 492                                                 paternal sib
## 493                                                 paternal sib
## 494                                                 paternal sib
## 495                                                 paternal sib
## 496                                                 paternal sib
## 497                                                 paternal sib
## 498                                                 paternal sib
## 499                                                 paternal sib
## 500                                                 paternal sib
## 501                                                 paternal sib
## 502                                                 paternal sib
## 503                                                 paternal sib
## 504                                             maternal non-kin
## 505                                             maternal non-kin
## 506                                             maternal non-kin
## 507                                             maternal non-kin
## 508                                             maternal non-kin
## 509                                             maternal non-kin
## 510                                             maternal non-kin
## 511                                             maternal non-kin
## 512                                             maternal non-kin
## 513                                             maternal non-kin
## 514                                             mother-offspring
## 515                                             mother-offspring
## 516                                             mother-offspring
## 517                                             mother-offspring
## 518                                             mother-offspring
## 519                                             mother-offspring
## 520                                             mother-offspring
## 521                                             mother-offspring
## 522                                             mother-offspring
## 523                                             mother-offspring
## 524                                             mother-offspring
## 525                                             mother-offspring
## 526                                             mother-offspring
## 527                                             mother-offspring
## 528                                                 paternal sib
## 529                                                 paternal sib
## 530                                                 paternal sib
## 531                                                 paternal sib
## 532                                                 paternal sib
## 533                                                 paternal sib
## 534                                                 paternal sib
## 535                                                 paternal sib
## 536                                                 paternal sib
## 537                                                 paternal sib
## 538                                                 paternal sib
## 539                                                 paternal sib
## 540                                                 paternal sib
## 541                                                 paternal sib
## 542                                                 paternal sib
## 543                                                 paternal sib
## 544                                                 paternal sib
## 545                                                 paternal sib
## 546                                                 paternal sib
## 547                                                 paternal sib
## 548                                                 paternal sib
## 549                                                 paternal sib
## 550                                                 paternal sib
## 551                                                     full sib
## 552                                                     full sib
## 553                                                     full sib
## 554                                                     full sib
## 555                                                     full sib
## 556                                                     full sib
## 557                                                     full sib
##     AgeDifference_years_Dyad DominanceRank_IndividualA DominanceRank_IndB
## 1                        2.0                     0.400              0.000
## 2                        2.0                     0.300              0.000
## 3                        4.9                     0.700              0.000
## 4                        4.9                     0.700              0.000
## 5                        3.0                     0.600              0.000
## 6                        3.0                     0.500              0.000
## 7                        1.1                     0.100              0.000
## 8                        1.1                     0.600              0.000
## 9                        4.3                     0.900              0.000
## 10                       4.3                     0.900              0.000
## 11                      15.9                     0.300              0.000
## 12                      15.9                     0.200              0.000
## 13                       2.1                     0.800              0.000
## 14                       2.1                     0.800              0.000
## 15                       6.7                     1.000              0.000
## 16                       6.7                     1.000              0.000
## 17                       8.9                     0.500              0.000
## 18                       8.9                     0.400              0.000
## 19                       6.2                     0.200              0.000
## 20                       6.2                     0.100              0.000
## 21                       3.0                     0.778              0.333
## 22                       3.0                     0.700              0.400
## 23                       3.0                     0.700              0.300
## 24                       1.0                     0.556              0.333
## 25                       1.0                     0.600              0.400
## 26                       1.0                     0.500              0.300
## 27                       0.9                     0.000              0.333
## 28                       0.9                     0.100              0.400
## 29                       0.9                     0.600              0.300
## 30                       2.3                     0.889              0.333
## 31                       2.3                     0.900              0.400
## 32                       2.3                     0.900              0.300
## 33                      13.9                     0.222              0.333
## 34                      13.9                     0.300              0.400
## 35                      13.9                     0.200              0.300
## 36                       0.2                     0.667              0.333
## 37                       0.2                     0.800              0.400
## 38                       0.2                     0.800              0.300
## 39                       4.7                     1.000              0.333
## 40                       4.7                     1.000              0.400
## 41                       4.7                     1.000              0.300
## 42                       7.0                     0.444              0.333
## 43                       7.0                     0.500              0.400
## 44                       7.0                     0.400              0.300
## 45                       4.2                     0.111              0.333
## 46                       4.2                     0.200              0.400
## 47                       4.2                     0.100              0.300
## 155                      2.0                     0.000              0.500
## 156                      2.0                     0.167              0.667
## 157                      2.0                     0.556              0.778
## 158                      2.0                     0.600              0.700
## 159                      2.0                     0.500              0.700
## 160                      3.8                     0.000              0.778
## 161                      3.8                     0.100              0.700
## 162                      3.8                     0.600              0.700
## 163                      0.6                     0.600              0.400
## 164                      0.6                     0.833              0.500
## 165                      0.6                     0.833              0.667
## 166                      0.6                     0.889              0.778
## 167                      0.6                     0.900              0.700
## 168                      0.6                     0.900              0.700
## 169                     10.9                     0.250              0.000
## 170                     10.9                     0.000              0.400
## 171                     10.9                     0.167              0.500
## 172                     10.9                     0.333              0.667
## 173                     10.9                     0.222              0.778
## 174                     10.9                     0.300              0.700
## 175                     10.9                     0.200              0.700
## 176                      2.8                     0.667              0.778
## 177                      2.8                     0.800              0.700
## 178                      2.8                     0.800              0.700
## 179                      1.8                     1.000              0.000
## 180                      1.8                     1.000              0.400
## 181                      1.8                     1.000              0.500
## 182                      1.8                     1.000              0.667
## 183                      1.8                     1.000              0.778
## 184                      1.8                     1.000              0.700
## 185                      1.8                     1.000              0.700
## 186                      4.0                     0.750              0.000
## 187                      4.0                     0.800              0.400
## 188                      4.0                     0.667              0.500
## 189                      4.0                     0.500              0.667
## 190                      4.0                     0.444              0.778
## 191                      4.0                     0.500              0.700
## 192                      4.0                     0.400              0.700
## 193                      1.3                     0.500              0.000
## 194                      1.3                     0.200              0.400
## 195                      1.3                     0.333              0.500
## 196                      1.3                     0.000              0.667
## 197                      1.3                     0.111              0.778
## 198                      1.3                     0.200              0.700
## 199                      1.3                     0.100              0.700
## 256                      1.9                     0.000              0.556
## 257                      1.9                     0.100              0.600
## 258                      1.9                     0.600              0.500
## 259                      1.3                     0.833              0.000
## 260                      1.3                     0.833              0.167
## 261                      1.3                     0.889              0.556
## 262                      1.3                     0.900              0.600
## 263                      1.3                     0.900              0.500
## 264                     12.9                     0.167              0.000
## 265                     12.9                     0.333              0.167
## 266                     12.9                     0.222              0.556
## 267                     12.9                     0.300              0.600
## 268                     12.9                     0.200              0.500
## 269                      0.8                     0.667              0.556
## 270                      0.8                     0.800              0.600
## 271                      0.8                     0.800              0.500
## 272                      3.7                     1.000              0.000
## 273                      3.7                     1.000              0.167
## 274                      3.7                     1.000              0.556
## 275                      3.7                     1.000              0.600
## 276                      3.7                     1.000              0.500
## 277                      6.0                     0.667              0.000
## 278                      6.0                     0.500              0.167
## 279                      6.0                     0.444              0.556
## 280                      6.0                     0.500              0.600
## 281                      6.0                     0.400              0.500
## 282                      3.2                     0.333              0.000
## 283                      3.2                     0.000              0.167
## 284                      3.2                     0.111              0.556
## 285                      3.2                     0.200              0.600
## 286                      3.2                     0.100              0.500
## 434                      3.2                     0.889              0.000
## 435                      3.2                     0.900              0.100
## 436                      3.2                     0.900              0.600
## 437                     14.8                     0.222              0.000
## 438                     14.8                     0.300              0.100
## 439                     14.8                     0.200              0.600
## 440                      1.0                     0.667              0.000
## 441                      1.0                     0.800              0.100
## 442                      1.0                     0.800              0.600
## 443                      5.6                     1.000              0.000
## 444                      5.6                     1.000              0.100
## 445                      5.6                     1.000              0.600
## 446                      7.8                     0.444              0.000
## 447                      7.8                     0.500              0.100
## 448                      7.8                     0.400              0.600
## 449                      5.1                     0.111              0.000
## 450                      5.1                     0.200              0.100
## 451                      5.1                     0.100              0.600
## 477                     11.6                     0.000              0.600
## 478                     11.6                     0.167              0.833
## 479                     11.6                     0.333              0.833
## 480                     11.6                     0.222              0.889
## 481                     11.6                     0.300              0.900
## 482                     11.6                     0.200              0.900
## 483                      2.2                     0.667              0.889
## 484                      2.2                     0.800              0.900
## 485                      2.2                     0.800              0.900
## 486                      2.4                     1.000              0.600
## 487                      2.4                     1.000              0.833
## 488                      2.4                     1.000              0.833
## 489                      2.4                     1.000              0.889
## 490                      2.4                     1.000              0.900
## 491                      2.4                     1.000              0.900
## 492                      4.6                     0.800              0.600
## 493                      4.6                     0.667              0.833
## 494                      4.6                     0.500              0.833
## 495                      4.6                     0.444              0.889
## 496                      4.6                     0.500              0.900
## 497                      4.6                     0.400              0.900
## 498                      1.9                     0.200              0.600
## 499                      1.9                     0.333              0.833
## 500                      1.9                     0.000              0.833
## 501                      1.9                     0.111              0.889
## 502                      1.9                     0.200              0.900
## 503                      1.9                     0.100              0.900
## 504                     13.7                     0.667              0.222
## 505                     13.7                     0.800              0.300
## 506                     13.7                     0.800              0.200
## 507                      9.2                     1.000              0.250
## 508                      9.2                     1.000              0.000
## 509                      9.2                     1.000              0.167
## 510                      9.2                     1.000              0.333
## 511                      9.2                     1.000              0.222
## 512                      9.2                     1.000              0.300
## 513                      9.2                     1.000              0.200
## 514                      6.9                     0.750              0.250
## 515                      6.9                     0.800              0.000
## 516                      6.9                     0.667              0.167
## 517                      6.9                     0.500              0.333
## 518                      6.9                     0.444              0.222
## 519                      6.9                     0.500              0.300
## 520                      6.9                     0.400              0.200
## 521                      9.6                     0.500              0.250
## 522                      9.6                     0.200              0.000
## 523                      9.6                     0.333              0.167
## 524                      9.6                     0.000              0.333
## 525                      9.6                     0.111              0.222
## 526                      9.6                     0.200              0.300
## 527                      9.6                     0.100              0.200
## 528                      4.6                     1.000              0.667
## 529                      4.6                     1.000              0.800
## 530                      4.6                     1.000              0.800
## 531                      6.8                     0.444              0.667
## 532                      6.8                     0.500              0.800
## 533                      6.8                     0.400              0.800
## 534                      4.1                     0.111              0.667
## 535                      4.1                     0.200              0.800
## 536                      4.1                     0.100              0.800
## 537                      2.2                     0.750              1.000
## 538                      2.2                     0.800              1.000
## 539                      2.2                     0.667              1.000
## 540                      2.2                     0.500              1.000
## 541                      2.2                     0.444              1.000
## 542                      2.2                     0.500              1.000
## 543                      2.2                     0.400              1.000
## 544                      0.5                     0.500              1.000
## 545                      0.5                     0.200              1.000
## 546                      0.5                     0.333              1.000
## 547                      0.5                     0.000              1.000
## 548                      0.5                     0.111              1.000
## 549                      0.5                     0.200              1.000
## 550                      0.5                     0.100              1.000
## 551                      2.7                     0.500              0.750
## 552                      2.7                     0.200              0.800
## 553                      2.7                     0.333              0.667
## 554                      2.7                     0.000              0.500
## 555                      2.7                     0.111              0.444
## 556                      2.7                     0.200              0.500
## 557                      2.7                     0.100              0.400
##     Centrality_IndividualA Centrality_IndividualB
## 1                    0.742                  0.705
## 2                    0.838                  0.866
## 3                    0.845                  0.705
## 4                    0.887                  0.866
## 5                    0.758                  0.705
## 6                    0.875                  0.866
## 7                    0.921                  0.705
## 8                    0.887                  0.866
## 9                    0.951                  0.705
## 10                   0.929                  0.866
## 11                   0.740                  0.705
## 12                   0.731                  0.866
## 13                   0.882                  0.705
## 14                   0.940                  0.866
## 15                   0.956                  0.705
## 16                   0.976                  0.866
## 17                   0.692                  0.705
## 18                   0.863                  0.866
## 19                   0.602                  0.705
## 20                   0.875                  0.866
## 21                   0.809                  0.766
## 22                   0.845                  0.742
## 23                   0.887                  0.838
## 24                   0.810                  0.766
## 25                   0.758                  0.742
## 26                   0.875                  0.838
## 27                   0.729                  0.766
## 28                   0.921                  0.742
## 29                   0.887                  0.838
## 30                   0.841                  0.766
## 31                   0.951                  0.742
## 32                   0.929                  0.838
## 33                   0.609                  0.766
## 34                   0.740                  0.742
## 35                   0.731                  0.838
## 36                   0.969                  0.766
## 37                   0.882                  0.742
## 38                   0.940                  0.838
## 39                   0.879                  0.766
## 40                   0.956                  0.742
## 41                   0.976                  0.838
## 42                   0.591                  0.766
## 43                   0.692                  0.742
## 44                   0.863                  0.838
## 45                   0.619                  0.766
## 46                   0.602                  0.742
## 47                   0.875                  0.838
## 155                     NA                     NA
## 156                     NA                     NA
## 157                  0.810                  0.809
## 158                  0.758                  0.845
## 159                  0.875                  0.887
## 160                  0.729                  0.809
## 161                  0.921                  0.845
## 162                  0.887                  0.887
## 163                     NA                     NA
## 164                     NA                     NA
## 165                     NA                     NA
## 166                  0.841                  0.809
## 167                  0.951                  0.845
## 168                  0.929                  0.887
## 169                     NA                     NA
## 170                     NA                     NA
## 171                     NA                     NA
## 172                     NA                     NA
## 173                  0.609                  0.809
## 174                  0.740                  0.845
## 175                  0.731                  0.887
## 176                  0.969                  0.809
## 177                  0.882                  0.845
## 178                  0.940                  0.887
## 179                     NA                     NA
## 180                     NA                     NA
## 181                     NA                     NA
## 182                     NA                     NA
## 183                  0.879                  0.809
## 184                  0.956                  0.845
## 185                  0.976                  0.887
## 186                     NA                     NA
## 187                     NA                     NA
## 188                     NA                     NA
## 189                     NA                     NA
## 190                  0.591                  0.809
## 191                  0.692                  0.845
## 192                  0.863                  0.887
## 193                     NA                     NA
## 194                     NA                     NA
## 195                     NA                     NA
## 196                     NA                     NA
## 197                  0.619                  0.809
## 198                  0.602                  0.845
## 199                  0.875                  0.887
## 256                  0.729                  0.810
## 257                  0.921                  0.758
## 258                  0.887                  0.875
## 259                     NA                     NA
## 260                     NA                     NA
## 261                  0.841                  0.810
## 262                  0.951                  0.758
## 263                  0.929                  0.875
## 264                     NA                     NA
## 265                     NA                     NA
## 266                  0.609                  0.810
## 267                  0.740                  0.758
## 268                  0.731                  0.875
## 269                  0.969                  0.810
## 270                  0.882                  0.758
## 271                  0.940                  0.875
## 272                     NA                     NA
## 273                     NA                     NA
## 274                  0.879                  0.810
## 275                  0.956                  0.758
## 276                  0.976                  0.875
## 277                     NA                     NA
## 278                     NA                     NA
## 279                  0.591                  0.810
## 280                  0.692                  0.758
## 281                  0.863                  0.875
## 282                     NA                     NA
## 283                     NA                     NA
## 284                  0.619                  0.810
## 285                  0.602                  0.758
## 286                  0.875                  0.875
## 434                  0.841                  0.729
## 435                  0.951                  0.921
## 436                  0.929                  0.887
## 437                  0.609                  0.729
## 438                  0.740                  0.921
## 439                  0.731                  0.887
## 440                  0.969                  0.729
## 441                  0.882                  0.921
## 442                  0.940                  0.887
## 443                  0.879                  0.729
## 444                  0.956                  0.921
## 445                  0.976                  0.887
## 446                  0.591                  0.729
## 447                  0.692                  0.921
## 448                  0.863                  0.887
## 449                  0.619                  0.729
## 450                  0.602                  0.921
## 451                  0.875                  0.887
## 477                     NA                     NA
## 478                     NA                     NA
## 479                     NA                     NA
## 480                  0.609                  0.841
## 481                  0.740                  0.951
## 482                  0.731                  0.929
## 483                  0.969                  0.841
## 484                  0.882                  0.951
## 485                  0.940                  0.929
## 486                     NA                     NA
## 487                     NA                     NA
## 488                     NA                     NA
## 489                  0.879                  0.841
## 490                  0.956                  0.951
## 491                  0.976                  0.929
## 492                     NA                     NA
## 493                     NA                     NA
## 494                     NA                     NA
## 495                  0.591                  0.841
## 496                  0.692                  0.951
## 497                  0.863                  0.929
## 498                     NA                     NA
## 499                     NA                     NA
## 500                     NA                     NA
## 501                  0.619                  0.841
## 502                  0.602                  0.951
## 503                  0.875                  0.929
## 504                  0.969                  0.609
## 505                  0.882                  0.740
## 506                  0.940                  0.731
## 507                     NA                     NA
## 508                     NA                     NA
## 509                     NA                     NA
## 510                     NA                     NA
## 511                  0.879                  0.609
## 512                  0.956                  0.740
## 513                  0.976                  0.731
## 514                     NA                     NA
## 515                     NA                     NA
## 516                     NA                     NA
## 517                     NA                     NA
## 518                  0.591                  0.609
## 519                  0.692                  0.740
## 520                  0.863                  0.731
## 521                     NA                     NA
## 522                     NA                     NA
## 523                     NA                     NA
## 524                     NA                     NA
## 525                  0.619                  0.609
## 526                  0.602                  0.740
## 527                  0.875                  0.731
## 528                  0.879                  0.969
## 529                  0.956                  0.882
## 530                  0.976                  0.940
## 531                  0.591                  0.969
## 532                  0.692                  0.882
## 533                  0.863                  0.940
## 534                  0.619                  0.969
## 535                  0.602                  0.882
## 536                  0.875                  0.940
## 537                     NA                     NA
## 538                     NA                     NA
## 539                     NA                     NA
## 540                     NA                     NA
## 541                  0.591                  0.879
## 542                  0.692                  0.956
## 543                  0.863                  0.976
## 544                     NA                     NA
## 545                     NA                     NA
## 546                     NA                     NA
## 547                     NA                     NA
## 548                  0.619                  0.879
## 549                  0.602                  0.956
## 550                  0.875                  0.976
## 551                     NA                     NA
## 552                     NA                     NA
## 553                     NA                     NA
## 554                     NA                     NA
## 555                  0.619                  0.591
## 556                  0.602                  0.692
## 557                  0.875                  0.863
##     PresenceMaleInfant_IndividualA PresenceFemaleInfant_IndividualA
## 1                                0                                1
## 2                                0                                0
## 3                                0                                0
## 4                                0                                0
## 5                                0                                0
## 6                                0                                0
## 7                                1                                0
## 8                                1                                0
## 9                                0                                0
## 10                               1                                0
## 11                               0                                1
## 12                               0                                0
## 13                               0                                0
## 14                               0                                0
## 15                               0                                0
## 16                               0                                1
## 17                               0                                0
## 18                               0                                0
## 19                               0                                0
## 20                               0                                0
## 21                               0                                1
## 22                               0                                0
## 23                               0                                0
## 24                               0                                0
## 25                               0                                0
## 26                               0                                0
## 27                               0                                0
## 28                               1                                0
## 29                               1                                0
## 30                               0                                0
## 31                               0                                0
## 32                               1                                0
## 33                               0                                0
## 34                               0                                1
## 35                               0                                0
## 36                               1                                0
## 37                               0                                0
## 38                               0                                0
## 39                               0                                0
## 40                               0                                0
## 41                               0                                1
## 42                               1                                0
## 43                               0                                0
## 44                               0                                0
## 45                               0                                0
## 46                               0                                0
## 47                               0                                0
## 155                              0                                0
## 156                              0                                0
## 157                              0                                0
## 158                              0                                0
## 159                              0                                0
## 160                              0                                0
## 161                              1                                0
## 162                              1                                0
## 163                              0                                0
## 164                              0                                1
## 165                              0                                0
## 166                              0                                0
## 167                              0                                0
## 168                              1                                0
## 169                              0                                0
## 170                              0                                1
## 171                              0                                0
## 172                              0                                1
## 173                              0                                0
## 174                              0                                1
## 175                              0                                0
## 176                              1                                0
## 177                              0                                0
## 178                              0                                0
## 179                              1                                0
## 180                              0                                0
## 181                              0                                1
## 182                              0                                1
## 183                              0                                0
## 184                              0                                0
## 185                              0                                1
## 186                              0                                1
## 187                              0                                1
## 188                              1                                0
## 189                              0                                0
## 190                              1                                0
## 191                              0                                0
## 192                              0                                0
## 193                              0                                0
## 194                              0                                1
## 195                              0                                1
## 196                              0                                0
## 197                              0                                0
## 198                              0                                0
## 199                              0                                0
## 256                              0                                0
## 257                              1                                0
## 258                              1                                0
## 259                              0                                1
## 260                              0                                0
## 261                              0                                0
## 262                              0                                0
## 263                              1                                0
## 264                              0                                0
## 265                              0                                1
## 266                              0                                0
## 267                              0                                1
## 268                              0                                0
## 269                              1                                0
## 270                              0                                0
## 271                              0                                0
## 272                              0                                1
## 273                              0                                1
## 274                              0                                0
## 275                              0                                0
## 276                              0                                1
## 277                              1                                0
## 278                              0                                0
## 279                              1                                0
## 280                              0                                0
## 281                              0                                0
## 282                              0                                1
## 283                              0                                0
## 284                              0                                0
## 285                              0                                0
## 286                              0                                0
## 434                              0                                0
## 435                              0                                0
## 436                              1                                0
## 437                              0                                0
## 438                              0                                1
## 439                              0                                0
## 440                              1                                0
## 441                              0                                0
## 442                              0                                0
## 443                              0                                0
## 444                              0                                0
## 445                              0                                1
## 446                              1                                0
## 447                              0                                0
## 448                              0                                0
## 449                              0                                0
## 450                              0                                0
## 451                              0                                0
## 477                              0                                1
## 478                              0                                0
## 479                              0                                1
## 480                              0                                0
## 481                              0                                1
## 482                              0                                0
## 483                              1                                0
## 484                              0                                0
## 485                              0                                0
## 486                              0                                0
## 487                              0                                1
## 488                              0                                1
## 489                              0                                0
## 490                              0                                0
## 491                              0                                1
## 492                              0                                1
## 493                              1                                0
## 494                              0                                0
## 495                              1                                0
## 496                              0                                0
## 497                              0                                0
## 498                              0                                1
## 499                              0                                1
## 500                              0                                0
## 501                              0                                0
## 502                              0                                0
## 503                              0                                0
## 504                              1                                0
## 505                              0                                0
## 506                              0                                0
## 507                              1                                0
## 508                              0                                0
## 509                              0                                1
## 510                              0                                1
## 511                              0                                0
## 512                              0                                0
## 513                              0                                1
## 514                              0                                1
## 515                              0                                1
## 516                              1                                0
## 517                              0                                0
## 518                              1                                0
## 519                              0                                0
## 520                              0                                0
## 521                              0                                0
## 522                              0                                1
## 523                              0                                1
## 524                              0                                0
## 525                              0                                0
## 526                              0                                0
## 527                              0                                0
## 528                              0                                0
## 529                              0                                0
## 530                              0                                1
## 531                              1                                0
## 532                              0                                0
## 533                              0                                0
## 534                              0                                0
## 535                              0                                0
## 536                              0                                0
## 537                              0                                1
## 538                              0                                1
## 539                              1                                0
## 540                              0                                0
## 541                              1                                0
## 542                              0                                0
## 543                              0                                0
## 544                              0                                0
## 545                              0                                1
## 546                              0                                1
## 547                              0                                0
## 548                              0                                0
## 549                              0                                0
## 550                              0                                0
## 551                              0                                0
## 552                              0                                1
## 553                              0                                1
## 554                              0                                0
## 555                              0                                0
## 556                              0                                0
## 557                              0                                0
##     PresenceMaleInfant_IndividualB PresenceFemaleInfant_IndividualB
## 1                                0                                0
## 2                                0                                0
## 3                                0                                0
## 4                                0                                0
## 5                                0                                0
## 6                                0                                0
## 7                                0                                0
## 8                                0                                0
## 9                                0                                0
## 10                               0                                0
## 11                               0                                0
## 12                               0                                0
## 13                               0                                0
## 14                               0                                0
## 15                               0                                0
## 16                               0                                0
## 17                               0                                0
## 18                               0                                0
## 19                               0                                0
## 20                               0                                0
## 21                               0                                1
## 22                               0                                1
## 23                               0                                0
## 24                               0                                1
## 25                               0                                1
## 26                               0                                0
## 27                               0                                1
## 28                               0                                1
## 29                               0                                0
## 30                               0                                1
## 31                               0                                1
## 32                               0                                0
## 33                               0                                1
## 34                               0                                1
## 35                               0                                0
## 36                               0                                1
## 37                               0                                1
## 38                               0                                0
## 39                               0                                1
## 40                               0                                1
## 41                               0                                0
## 42                               0                                1
## 43                               0                                1
## 44                               0                                0
## 45                               0                                1
## 46                               0                                1
## 47                               0                                0
## 155                              1                                0
## 156                              0                                0
## 157                              0                                1
## 158                              0                                0
## 159                              0                                0
## 160                              0                                1
## 161                              0                                0
## 162                              0                                0
## 163                              0                                0
## 164                              1                                0
## 165                              0                                0
## 166                              0                                1
## 167                              0                                0
## 168                              0                                0
## 169                              0                                0
## 170                              0                                0
## 171                              1                                0
## 172                              0                                0
## 173                              0                                1
## 174                              0                                0
## 175                              0                                0
## 176                              0                                1
## 177                              0                                0
## 178                              0                                0
## 179                              0                                0
## 180                              0                                0
## 181                              1                                0
## 182                              0                                0
## 183                              0                                1
## 184                              0                                0
## 185                              0                                0
## 186                              0                                0
## 187                              0                                0
## 188                              1                                0
## 189                              0                                0
## 190                              0                                1
## 191                              0                                0
## 192                              0                                0
## 193                              0                                0
## 194                              0                                0
## 195                              1                                0
## 196                              0                                0
## 197                              0                                1
## 198                              0                                0
## 199                              0                                0
## 256                              0                                0
## 257                              0                                0
## 258                              0                                0
## 259                              0                                0
## 260                              0                                0
## 261                              0                                0
## 262                              0                                0
## 263                              0                                0
## 264                              0                                0
## 265                              0                                0
## 266                              0                                0
## 267                              0                                0
## 268                              0                                0
## 269                              0                                0
## 270                              0                                0
## 271                              0                                0
## 272                              0                                0
## 273                              0                                0
## 274                              0                                0
## 275                              0                                0
## 276                              0                                0
## 277                              0                                0
## 278                              0                                0
## 279                              0                                0
## 280                              0                                0
## 281                              0                                0
## 282                              0                                0
## 283                              0                                0
## 284                              0                                0
## 285                              0                                0
## 286                              0                                0
## 434                              0                                0
## 435                              1                                0
## 436                              1                                0
## 437                              0                                0
## 438                              1                                0
## 439                              1                                0
## 440                              0                                0
## 441                              1                                0
## 442                              1                                0
## 443                              0                                0
## 444                              1                                0
## 445                              1                                0
## 446                              0                                0
## 447                              1                                0
## 448                              1                                0
## 449                              0                                0
## 450                              1                                0
## 451                              1                                0
## 477                              0                                0
## 478                              0                                1
## 479                              0                                0
## 480                              0                                0
## 481                              0                                0
## 482                              1                                0
## 483                              0                                0
## 484                              0                                0
## 485                              1                                0
## 486                              0                                0
## 487                              0                                1
## 488                              0                                0
## 489                              0                                0
## 490                              0                                0
## 491                              1                                0
## 492                              0                                0
## 493                              0                                1
## 494                              0                                0
## 495                              0                                0
## 496                              0                                0
## 497                              1                                0
## 498                              0                                0
## 499                              0                                1
## 500                              0                                0
## 501                              0                                0
## 502                              0                                0
## 503                              1                                0
## 504                              0                                0
## 505                              0                                1
## 506                              0                                0
## 507                              0                                0
## 508                              0                                1
## 509                              0                                0
## 510                              0                                1
## 511                              0                                0
## 512                              0                                1
## 513                              0                                0
## 514                              0                                0
## 515                              0                                1
## 516                              0                                0
## 517                              0                                1
## 518                              0                                0
## 519                              0                                1
## 520                              0                                0
## 521                              0                                0
## 522                              0                                1
## 523                              0                                0
## 524                              0                                1
## 525                              0                                0
## 526                              0                                1
## 527                              0                                0
## 528                              1                                0
## 529                              0                                0
## 530                              0                                0
## 531                              1                                0
## 532                              0                                0
## 533                              0                                0
## 534                              1                                0
## 535                              0                                0
## 536                              0                                0
## 537                              1                                0
## 538                              0                                0
## 539                              0                                1
## 540                              0                                1
## 541                              0                                0
## 542                              0                                0
## 543                              0                                1
## 544                              1                                0
## 545                              0                                0
## 546                              0                                1
## 547                              0                                1
## 548                              0                                0
## 549                              0                                0
## 550                              0                                1
## 551                              0                                1
## 552                              0                                1
## 553                              1                                0
## 554                              0                                0
## 555                              1                                0
## 556                              0                                0
## 557                              0                                0
View(group1)
group1A<-group1[1:5]
group1B<-group1[10:11]
group1<-cbind(group1A, group1B)
ID<-group1[3, 5:6]
View(ID)
ID1<-group1[3]
ID2<-group1[5:6]
ID<-cbind(ID1, ID2)
View(ID)
ID1<-group1[c(1:20),]
View(ID1)
ID1<-ID1[4:5]
ID1<-group1[c(1:20),]
ID2<-ID1[4:5]
ID3<-ID1[7]
ID1<-cbind(ID1, ID2)
ID1<-cbind(ID2, ID3)
cols<-c("ID", "Year","Rank")
colnames(ID)<-cols
colnames(ID1)<-cols
group1_r<-rbind(ID, ID1)
View(group1_r)

#Next, let's try plotting this by using base plot.

plot(group1_r$Year, group1_r$Rank)

plot(group1_r$Year, group1_r$Rank, pch = 19, 
     col=c("red", "blue", "green", "orange", "purple", "pink", "black", "brown", "grey", "yellow", "red"),xlab = "x", ylab = "y")
# Add a legend to the plot.
legend("topright", legend=c("1", "2", "8", "11", "18", "26", "27", "28", "29", "30", "32"),
       col=c("red", "blue", "green", "orange", "purple", "pink", "black", "brown", "grey", "yellow", "red"), lty = 1:2, cex=0.8) 

#I wanted to differentiate the points at first, so I began with color.
#This is clearly not great. BOOOOOOOO.  There is no good way to do a line here.  Let's do ggplot instead.
#Lets try ggplot instead, which we can get to by opening up tidyverse.
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.1.2
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v tibble  3.1.6     v dplyr   1.0.7
## v tidyr   1.1.4     v stringr 1.4.0
## v readr   2.1.1     v forcats 0.5.1
## v purrr   0.3.4
## Warning: package 'tibble' was built under R version 4.1.2
## Warning: package 'tidyr' was built under R version 4.1.2
## Warning: package 'readr' was built under R version 4.1.2
## Warning: package 'purrr' was built under R version 4.1.2
## Warning: package 'dplyr' was built under R version 4.1.2
## Warning: package 'stringr' was built under R version 4.1.2
## Warning: package 'forcats' was built under R version 4.1.2
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x tidyr::expand()     masks Matrix::expand()
## x tidyr::extract()    masks magrittr::extract()
## x dplyr::filter()     masks stats::filter()
## x dplyr::lag()        masks stats::lag()
## x tidyr::pack()       masks Matrix::pack()
## x readr::parse_date() masks curl::parse_date()
## x purrr::set_names()  masks magrittr::set_names()
## x tidyr::unpack()     masks Matrix::unpack()
ggplot(data = group1_r, mapping = aes(Year, Rank,group=ID))+  geom_line(aes(linetype=as.character(ID)), color="black", size=1.2)+
  geom_point(aes(shape=as.character(ID)),size=3)
## Warning: The shape palette can deal with a maximum of 6 discrete values because
## more than 6 becomes difficult to discriminate; you have 11. Consider
## specifying shapes manually if you must have them.
## Warning: Removed 154 rows containing missing values (geom_point).

#scale_shape_manual with the following numbers could make the data points exact: 0:1:2:4:5:6:15:16:17:1:0.  Mel and I could not figure out the exact way to do this. 
#ggplot you are a beautiful, beautiful little baby!

Here is the graph as published. For the graph that we recreated, take a look at the bottom left figure, entitled “Group 1”.

After spending a frustrating amount of time on table 1, I decided maybe table s2 would go better. But…alas…it did not! Why? Because half of the information was inaccessible. I could not find which individuals were with which group (and this is coming from someone who lived and worked with these groups for several months). The dates (Period Start and Period End) were also not available. It is possible I could have figured out the infant survival with some work.

As much as I love these Capuchin monkeys, this was the second paper that I choose and it was incredibly difficult to replicate. There were certain aspects that were not well defined and/or organized. I don’t understand why some of the calculations were not saved in the excel file. Obviously they had to do more work on r because of this (and it also made it much more difficult to replicate). Additionally, it was not always clear what variables they used in the LMMs. Truly this is one of the most difficult, frustrating, rewarding courses I have ever taken. Am I amazing at stats or coding? No. Am I working my butt off and excited to continue to? Yes.

PLESE NOTE: I used so many resources when doing this assignment. I feel as though I practically lived in your office hours. Mel and I spent uupwards of 4 hours working on this together. I reached out to the PhD student working at the lab where this paper was written for advice on the lmm. I reached out to FIVE of my PhD student friends across the country to help me figure this out. My blood, sweat and tears are in this code.